<?php
$GLOBALS['basePath'] = '../';
require_once '../class/PHONGBAN.php';
require_once '../class/common.php';

$depts = PHONGBAN::Select();
EchoHeader('Phòng ban', 'department');	
?>
<style type="text/css">
	#content .primary { width: 300px; }
	
	.button { font-size: 12px; }
	
	#TenPhong {	width: 200px; }
	
	.MaPhong { width: 70px; }
	
	.TenPhong { min-width: 120px; }
</style>

<div class="primary box">
	<div class="box-inside">
		<div class="heading">
			<h2>Danh sách phòng ban</h2>
			<div class="buttons">
				<a href="create.php" class="button">Thêm</a>
			</div>
		</div>
		<table class="tablist">
			<tr>
				<th class="MaPhong">Mã phòng</th>
				<th class="TenPhong">Tên phòng</th>
				<th></th>
			</tr>
			<?php
			foreach ($depts as $dept) {
				echo '<tr>';
				$record = sprintf('
					<td>%s</td>
					<td>%s</td>
					<td>
						<a href="edit.php?Id=%d"><img src="../image/edit.gif" alt="" /></a>
						<a href="../nhanvien/?phong=%d"><img src="../image/browse.png" alt="" /></a>
					</td>', $dept['MaPhong'], $dept['TenPhong'], $dept['MaPhong'], $dept['MaPhong']);
				echo $record;
				echo '</tr>';
			}
			?>
		</table>
		<form method="post" action="create.php" name="frmPhongBan" onSubmit="return onDSPBSubmit()">
			<div class="box-footer">
				<input id="TenPhong" name="TenPhong" value="" />
				<input type="submit" name="Submit" value="Thêm" class="button" />
			</div>
		</form>
	</div>
</div>
<?php EchoFooter(); ?>